

using System.ComponentModel;
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;

using CIndicators;
using CStock;
using CUtil;

using System.Collections.Generic;


namespace CStock
{
    public class DataClassDaily : DataClass, IDataClassDaily
    {

		#region private fields
		
		protected new bool intraday = false;
		private int initializeLevel ;

		#endregion

		#region Constructor
	
		public DataClassDaily()
		{
            this.iD = "JunkDaily";
            //this.dataClassIntraday = new DataClassIntraday(this);
           
            ResetPathFromConfiguration();
			
		}
        public override bool ResetPathFromConfiguration()
        {
            
            ProgramContext pc = ProgramContext.Instance;
            Debug.Assert(pc != null, "Initialize ProgramContext first ...");
            if (pc != null)
                this.path = pc.Configuration.Directories.QuotesDataPath ;
            return true;


        }

     
		
		#endregion

		#region Properties

		//[System.Xml.Serialization.XmlIgnoreAttribute()]
		[Category("Exchange Data"),Description(@"Data related to the exchange")]
		public override string ID
		{
			get
			{
				
				return this.iD;
			}
			set
			{
				this.iD = value;
                
			}
		}

        public override string ToString()
        {
            return this.iD;
        }
      
       

		
	
	

		

	
	
		[System.Xml.Serialization.XmlIgnoreAttribute()]
		public int InitializeLevel
		{
			get 
			{
				return initializeLevel; 
			}
			set 
			{ 
				initializeLevel = value ; 
			}
		}
       


		#endregion

        #region StockObject

        [System.Xml.Serialization.XmlIgnoreAttribute()]
        public IList<double> Items
        {
            get
            {
                if (ProgramContext.Instance.Configuration.IntradayModus)
                {
                    return this.SeriesOpen;
                }
                else
                {
                    this.CheckQuoteCollection();
                    return this.seriesClose;

                }
            }

        }

        #endregion

        #region serialization

        public override bool Serialize()
        {
            this.ResetPathFromConfiguration();
            //if (this.dataClassIntraday.QuoteCollection != null && this.dataClassIntraday.QuoteCollection.Count > 0)
            //    this.dataClassIntraday.Serialize();

            return base.Serialize();


        }

        public override bool DeSerialize(ref object o)
        {
            //IDataClassDaily dcd = new DataClassDaily();
            //do not stop if it cannot be deserialized

            //if (!DeSerialize_IntradayPart())
            //{
            //    this.dataClassIntraday = new DataClassIntraday(this);

            //}
            DataClassDaily dcd = new DataClassDaily();
            dcd.ID = this.ID;
            object o1 = dcd;


            if (base.DeSerialize(ref o1))
            {
                o = o1;
                dcd = o as DataClassDaily;
                //dcd.DataClassIntraday = this.dataClassIntraday;
                return true;

            }
            return false;

        }

        #endregion

		#region Implementation - read data
		
        

		#endregion

		#region methods quote collections

        //protected override void CheckQuotes()
        //{
        //    if(this.seriesTime == null)
        //    {
        //        ReadQuotes(false);
        //    }
        //}
	

		#endregion



    }
}

